Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of setNativeProps #10934

Closed
wants to merge 35 commits into from
Closed

Remove usage of setNativeProps #10934

wants to merge 35 commits into from

Conversation

rushatgabhane
Copy link
Member

@rushatgabhane rushatgabhane commented Sep 10, 2022

Why?

setNativeProps will not be supported in the post-Fabric world (docs). Removing it's usage is a prerequisite to enable Fabric in #8503

Details

For SignInPageForm, TextInputLabel/index and TextInput/index
Usage of setNativeProps is migrated to setAttribute

For ReportActionCompose, Form, OptionsSelector and ReportSettingsPage
Usage of setNativeProps is migrated to state

For InvertedFlatList
Usage of setNativeProps is migrated by passing styles.translate0InvertY as a prop

For Picker and ReportActionItemMessageEdit
Usage of setNativeProps is just removed. No migration was needed.

RoomNameInput was modified to support controlled inputs using value prop.

Fixed Issues

$ #8503
(prerequisite step)

Tests

Lotsss of tests here. Brace yourself!

Sign In page

  1. Navigate to NewDot on the web.
  2. Right-click on the email field.
  3. Click on the 1Password option to show the autofill.
  4. 1Password Autofill option should be shown on the input.

New group page / OptionsSelector

  1. Click on green fab icon (+)
  2. New group
  3. Type the email address of a contact that you have.
  4. Select the contact
  5. Verify that the entered text is selected.

image

Message Edit

  1. Navigate to a chat in New expensify
  2. Send a message.
  3. Hover over the message and click on the edit comment option in the menu
  4. Verify that the cursor is set to the end of the message.

And
On web and desktop

  1. Navigate to a chat in New expensify
  2. Send a message.
  3. Tap up arrow key to edit the previous comment.
  4. See the cursor is set to the end of the message.

Picker

  1. Run npm run storybook and test picker functionalities. Make sure that we can edit the input and all values are updated accordinly.
  2. Test ALL usages of Picker (any dropdown select input) in the app. Set new value, update value and verify error states
  • Settings > Payments > Add payment method > Add debit card > Select state
  • Workspace > Connect bank account (Additional information) > State
  • Policy room (#announce) > Settings > Notify me about new messages
  • Settings > Preferences > Priority mode
  • Settings > Preferences > Language
  • Settings > Profile > Preferred pronouns
  • Settings > Profile > Timezone
  • Workspace > Connect bank account (Company step) > Address state
  • Workspace > Connect bank account (Company step) > Company type
  • Workspace > Connect bank account (Company step) > Corporation state
  • Workspace > Connect bank account (Personal information) > State
  • Login page > Select locale (below terms and conditions)

Form component

  1. Run npm run storybook and test Form. Make sure that we can edit the input and all values are updated accordingly.
  2. Verify that form inputs validate on Blur and Submit.
  3. Verify that the correct values are being submitted.

Address search

  1. Go to Settings - Payments -> Add payment method -> Add debit card page
  2. Verify that you can search an address.
  3. Verify that you can select an address.

Pages using Form.js

  1. Add debit card page
    1. Go to Settings - Payments -> Add payment method -> Add debit card page
    2. Verify that you can edit all inputs.
    3. Verify that the input is being validated on blur, and submit.
  2. Request a call page
    1. Go to Concierge -> Click on the call button
    2. Verify that you can edit all inputs.
    3. Verify that the input is being validated on blur, and submit.
  3. Profile page
    1. Go to settings -> Profile
    2. Verify that you can edit all inputs.
    3. Verify that the input is being validated on blur, and submit.

Chat / InvertedFlatList

On Safari and Firefox,

  1. Verify that the scrolling a chat isn't "choppy"

Composer

  1. Go to any chat
  2. Verify that you can type text in the composer.
  3. Open emoji picker
  4. Verify that you can add emojis, and that cursor postion is after emoji.

This step is not applicable for QA - Room name input

Prerequisite - comment out the validations in ReportSettingsPage

  1. Click on green fab icon (+)
  2. Create a new room with the name "foo"
  3. Repeat step 1, and create a new room with the name "bar" in the same workspace as room "foo".
  4. Go to room "bar" -> Room settings
  5. Rename it to "foo"
  6. Click Save
  7. Click the "X" mark after RBR error.
  8. Verify that room name input is now back to "bar".
Screen.Recording.2022-09-10.at.6.31.51.PM.mov
  • Verify that no errors appear in the JS console

PR Review Checklist

Contributor (PR Author) Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • Any functional components have the displayName property
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

PR Reviewer Checklist

The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • Any functional components have the displayName property
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

QA Steps

Sign In page

  1. Navigate to NewDot on the web.
  2. Right-click on the email field.
  3. Click on the 1Password option to show the autofill.
  4. 1Password Autofill option should be shown on the input.

New group page / OptionsSelector

  1. Click on green fab icon (+)
  2. New group
  3. Type the email address of a contact that you have.
  4. Select the contact
  5. Verify that the entered text is selected.

image

Message Edit

  1. Navigate to a chat in New expensify
  2. Send a message.
  3. Hover over the message and click on the edit comment option in the menu
  4. Verify that the cursor is set to the end of the message.

And
On web and desktop

  1. Navigate to a chat in New expensify
  2. Send a message.
  3. Tap up arrow key to edit the previous comment.
  4. See the cursor is set to the end of the message.

Picker

  1. Got to storybook and test picker functionalities. Make sure that we can edit the input and all values are updated accordinly.
  2. Test ALL usages of Picker (any dropdown select input) in the app. Set new value, update value and verify error states
  • Settings > Payments > Add payment method > Add debit card > Select state
  • Workspace > Connect bank account (Additional information) > State
  • Policy room (#announce) > Settings > Notify me about new messages
  • Settings > Preferences > Priority mode
  • Settings > Preferences > Language
  • Settings > Profile > Preferred pronouns
  • Settings > Profile > Timezone
  • Workspace > Connect bank account (Company step) > Address state
  • Workspace > Connect bank account (Company step) > Company type
  • Workspace > Connect bank account (Company step) > Corporation state
  • Workspace > Connect bank account (Personal information) > State
  • Login page > Select locale (below terms and conditions)

Form component

  1. Go to storybook and test Form. Make sure that we can edit the input and all values are updated accordingly.
  2. Verify that form inputs validate on Blur and Submit.
  3. Verify that the correct values are being submitted.

Pages using Form.js

  1. Add debit card page
    1. Go to Settings - Payments -> Add payment method -> Add debit card page
    2. Verify that you can edit all inputs.
    3. Verify that the input is being validated on blur, and submit.
  2. Request a call page
    1. Go to Concierge -> Click on the call button
    2. Verify that you can edit all inputs.
    3. Verify that the input is being validated on blur, and submit.
  3. Profile page
  4. Go to settings -> Profile
  5. Verify that you can edit all inputs.
  6. Verify that the input is being validated on blur, and submit.

Chat / InvertedFlatList

On Safari and Firefox,

  1. Verify that the scrolling a chat isn't "choppy"

Composer

  1. Go to any chat
  2. Verify that you can type text in the composer.
  3. Open emoji picker
  4. Verify that you can add emojis, and that cursor postion is after emoji.
  • Verify that no errors appear in the JS console

Screenshots

Web

Mobile Web

Desktop

iOS

Android

@melvin-bot
Copy link

melvin-bot bot commented Sep 10, 2022

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@rushatgabhane rushatgabhane marked this pull request as ready for review September 10, 2022 13:10
@rushatgabhane rushatgabhane requested a review from a team as a code owner September 10, 2022 13:10
@melvin-bot melvin-bot bot requested review from stitesExpensify and removed request for a team September 10, 2022 13:10
@@ -67,6 +63,7 @@ class InvertedFlatList extends React.Component {
ref={el => this.list = el}
shouldMeasureItems
contentContainerStyle={StyleSheet.compose(this.props.contentContainerStyle, styles.justifyContentEnd)}
style={styles.translate0InvertY}
Copy link
Member Author

@rushatgabhane rushatgabhane Sep 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context - we have to remove usage of setNativeProps from app as a prereq to enabling Fabric.

@marcaaron do you remember if there's any downside to pass this style as a prop vs using setNativeProps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Change if this works. the setnativeProps were causing issues.

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setnativeProps were causing issues

out of curiousity, do you remember what kind of issues?

Copy link
Member Author

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: This is fixed - #10934 (comment)


Bug - AddressSearch when used with Form is broken. (https://expensify.slack.com/archives/C01GTK53T8Q/p1663164808524219)

  1. Go to Settings -> Payments -> Add payment method -> Add debit card
  2. Search for any billing address
  3. Click a suggested address

Expected: Street address, City, State and Zipcode are autofilled.
Actual: Nothing happens

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Sep 11, 2022

AddressSearch when used with Form is broken.

This is because Form was designed to be uncontrolled. I fixed this by automatically passing a value prop to all Form inputs.
value: this.state.inputValues[inputID]

Todo:

  • Update Form docs (I'll do this once all the form changes are finalized)

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Sep 13, 2022

asked for @parasharrajat's review to get the wheels rolling

// eslint-disable-next-line no-param-reassign
node.setNativeProps = this.setNativeProps;
}}
ref={this.props.innerRef}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did i do this right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Form passes a function to register this ref, so we should do something similar to this, no?

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few thoughts. I will start my review soon. There a lot of things to go over.

package.json Outdated
Comment on lines 135 to 136
"@storybook/builder-webpack5": "^6.5.10",
"@storybook/manager-webpack5": "^6.5.10",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change in this PR?

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's so that we can test on storybook.
storybook is currently broken on main.

I created a seperate PR for fixing storybook - #10933
This diff will go away once it's merged

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging main should get rid of this diff since the storybook PR is merged

@@ -67,6 +63,7 @@ class InvertedFlatList extends React.Component {
ref={el => this.list = el}
shouldMeasureItems
contentContainerStyle={StyleSheet.compose(this.props.contentContainerStyle, styles.justifyContentEnd)}
style={styles.translate0InvertY}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Change if this works. the setnativeProps were causing issues.

@@ -2671,6 +2671,10 @@ const styles = {
fontFamily: fontFamily.GTA,
marginLeft: 6,
},

translate0InvertY: {
transform: 'translate3d(0,0,0) scaleY(-1)',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be causing issues on Native if used. Even if this is used for the web, we can't put it into the global stylesheet. Use proper format for the transformation in react-native. In the future, someone can use it or can be confused by it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeahh, didn't think about it.
I'll see where it could be moved

src/components/InvertedFlatList/index.js Outdated Show resolved Hide resolved
Comment on lines -50 to +31
value={this.props.value || this.pickerValue}
value={this.props.value || this.props.defaultValue}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concept of defaultValue is unnecessary when we are using state-bound value prop.

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree! I'll explain why I didn't remove it in this PR.

I think all Form components are state based / value prop driven. But Form.js passes defaultValue to all it's children anyway because it was designed to be uncontrolled.

I reckon we should do the cleanup in a follow-up PR.

defaultValue,

I wanted to avoid adding more tests or break anything basically

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, StatePicker uses defaultValue.

We'd be introducing unrelated diffs and tests.

@@ -56,17 +37,9 @@ class BasePicker extends React.Component {
pickerProps={{
onFocus: this.props.onOpen,
onBlur: this.executeOnCloseAndOnBlur,
ref: this.props.innerRef,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. Must be a mistake :))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this

Comment on lines +53 to +69

this.onInputChange = this.onInputChange.bind(this);
}

/**
* Forms use inputID to set values. But Picker passes an index as the second parameter to onInputChange
* We are overriding this behavior to make Picker work with Form
* @param {String} value
* @param {Number} index
*/
onInputChange(value, index) {
if (this.props.inputID) {
this.props.onInputChange(value, this.props.inputID);
return;
}

this.props.onInputChange(value, index);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this change related to this PR?

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question! @parasharrajat

Anytime a Form input's value is changed, onInputChange() is called.

If you'll look at Form.js

App/src/components/Form.js

Lines 161 to 166 in 97ebb65

onInputChange: (value, key) => {
const inputKey = key || inputID;
this.setState(prevState => ({
inputValues: {
...prevState.inputValues,
[inputKey]: value,

It keeps track of input values based on the key provided to it.
And this "key" is supposed to be the formID used by the Form input.

So our expected function call looks something like this - onInputChange('Portugal', 'countryPicker')


Prerequisite: Picker is used in a Form.

Now RNPickerSelect comes into picture.

It passes the picker item's index as the second parameter. (source)

So this is what actually gets called - onInputChange('Portugal', 156). (where 156 is the index of Portugal in a list)

Our Form based picker now will try to change the value of an input whose formID is 156.
And bam 💥 our Form based picker doesn't work anymore.

I'm just fixing this by passing the formID as the second param, because we don't care aobut the index lol

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't a problem before because previously, Form set the value using ref.setNativeProps.

We're getting rid of that, so I had to fix Picker in this PR only.

inputRef.setNativeProps({value});

Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
@rushatgabhane rushatgabhane mentioned this pull request Sep 13, 2022
93 tasks
@luacmartins luacmartins self-requested a review September 14, 2022 14:43
@luacmartins
Copy link
Contributor

@parasharrajat please let me know once you are done reviewing this one.

@parasharrajat
Copy link
Member

Sure, Can I get assigned to the issue as well?

@luacmartins
Copy link
Contributor

@parasharrajat hmm I see that this PR is only a part of the linked issue. Do you intend to work on the full migration to Fabric?

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would have been better to break this changes into multiple PRs so it's easier to test them. I'll test once the change requests have been addressed.

}

return React.cloneElement(child, {
ref: node => this.inputRefs[inputID] = node,
defaultValue,
value: this.state.inputValues[inputID],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this means that inputs are no longer uncontrolled?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luacmartins yes, that's right

@@ -56,17 +37,9 @@ class BasePicker extends React.Component {
pickerProps={{
onFocus: this.props.onOpen,
onBlur: this.executeOnCloseAndOnBlur,
ref: this.props.innerRef,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this

// eslint-disable-next-line no-param-reassign
node.setNativeProps = this.setNativeProps;
}}
ref={this.props.innerRef}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Form passes a function to register this ref, so we should do something similar to this, no?

this.setState({
isCommentEmpty: !!newComment.match(/^(\s|`)*$/),
value: newComment,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add value to state

@@ -97,7 +97,6 @@ class ReportActionItemMessageEdit extends React.Component {
* @param {String} newDraft
*/
updateDraft(newDraft) {
this.textInput.setNativeProps({text: newDraft});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make sure this issue doesn't come back

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I have already added tests for it

@@ -291,7 +291,6 @@ class ProfilePage extends Component {
items={timezones}
isDisabled={this.state.isAutomaticTimezone}
defaultValue={this.state.selectedTimezone}
value={this.state.selectedTimezone}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove other usages of this.state.selectedTimezone in this file?

Copy link
Member Author

@rushatgabhane rushatgabhane Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't because it's controlled.
I now removed defaultValue, and passed value.

@@ -2671,6 +2671,10 @@ const styles = {
fontFamily: fontFamily.GTA,
marginLeft: 6,
},

translate0InvertY: {
transform: 'translate3d(0,0,0) scaleY(-1)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the correct format?

Suggested change
transform: 'translate3d(0,0,0) scaleY(-1)',
transform: [{translateX: 0}, {translateY: 0}, {scaleY: -1}],

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have to verify. I'll breakup all this into multiple PRs.

@rushatgabhane
Copy link
Member Author

I think it would have been better to break this changes into multiple PRs so it's easier to test them. I'll test once the change requests have been addressed.

@luacmartins I agree.
I'll work on breaking them into multiple PRs.

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Sep 16, 2022

Closing and splitting this PR into logical chunks for easy review and testing.

#11039
#11038
#11037
#11036
#11035
#11034
#11033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants